<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="d" uri="http://dgg.net/jsp/jstl/core" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt" %>

<div class="layer-warp">
    <form id="suspend">
        <input type="hidden" name="id" id="id" value="${scProductOrder.id}">
        <table class="add-table">
            <tbody>
            <tr>
                <th>当前生产节点：</th>
                <td>${scProductOrder.latestEndNodeName}</td>
            </tr>
            <tr>
                <th><span class="required">预计开启时间：</span></th>
                <td>
                    <input type="text" name="expectOpenTime" placeholder="预计开启时间" class="Wdate input-style"
                           id="expectOpenTime"
                           onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'now()'})">
                </td>
            </tr>
            </tbody>
        </table>
        <div class="popups-info">
            <div class="remark-input-box">
                <p class="mb8"><span class="required">备注：</span></p>
                <textarea class="textarea-style" rows="3" id="remark" name="remark" placeholder="500字以内" ></textarea>
            </div>
            <ul class="data-warp">
                <li>
                    <a href="javascript:void(0)" class="upload-button" id="upload"></a>
                    <input class="layui-upload-file" type="file" name="file" multiple="" id="annexUpload"
                           data-type="product"  data-fileid="${scProductOrder.id}">
                    <p>上传附件</p>
                </li>
            </ul>
        </div>
    </form>
</div>
    <!--生产暂停 end-->

<script src="${rootUrl}/static/js/zzsc/common/files/annex.js?v=${version}" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">

    $(document).ready(function () {
        areaLength($('#remark'),500)
    });
    function suspendProOrder() {
        var expectOpenTime = $("#expectOpenTime").val();
        if (!expectOpenTime.trim()){
            DGG.Warning('预计开启时间不能为空！');
            return;
        }
        var remark = $('[name="remark"]').val();
        if (remark == null || '' === remark) {
            DGG.Warning('备注不能为空！');
            return;
        }
        var id = $("#id").val();
        DGG.Confire("确认暂停订单吗？", '暂停订单', function () {
            DGG.loading();
            $.ajax({
                url: sysInfo.basePath + '/zzsc/inprocess/suspend_pro_order.do',
                data: {expectOpenTime:expectOpenTime,remark:remark,id:id},
                type: "POST",
                dataType: "json",
                success: function (obj) {
                    DGG.loading('close');
                    if (obj.code != 0) {
                        DGG.Errors(obj.msg);
                    } else {
                        DGG.Succeed('操作成功!');
                       window.location.reload();
                    }
                }
            });
        }, function () {

        });
    }
</script>
